function G = own_gradient(f, x0, f0)

    n = length(x0);
    G = zeros(n,1);
    
    diff = 0.01;
    
    for i=1:n     
        
        % simpler approach
        offset = zeros(size(x0));
        offset(i) = diff;

        G(i) = (f(x0+offset) - f0)/ diff;   
    end
    
end